brute force implementation *800

Please click on ads to support us..

Python Code:

card={ 'a', 'e', 'i', 'o', 'u'}
a=input()
x=0
for c in a:
	if c in card:
		x+=1
	elif c.isdigit() and int(c)%2==1:
		x+=1
print(x)

C++ Code:

#include <bits/stdc++.h>
#define int long long
#define endl "\n"
using namespace std;
int32_t main()
{
    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    string s;cin>>s;
    int cnt=0;
    for(auto x : s){
        if(x=='a' or x=='e' or x=='i' or x=='o' or x=='u'
           or x=='1' or x=='3' or x=='5'
           or x=='7' or x=='9')cnt++;
    }
    cout<<cnt<<endl;
}


Comments

Submit
0 Comments
More Questions

938A - Word Correction
159C - String Manipulation 10
258A - Little Elephant and Bits
1536C - Diluc and Kaeya
1428C - ABBB
1557A - Ezzat and Two Subsequences
255A - Greg's Workout
1059A - Cashier
1389C - Good String
1561A - Simply Strange Sort
1337B - Kana and Dragon Quest game
137C - History
1443C - The Delivery Dilemma
6C - Alice Bob and Chocolate
1077C - Good Array
285B - Find Marble
6A - Triangle
1729A - Two Elevators
1729B - Decode String
1729C - Jumping on Tiles
1729E - Guess the Cycle Size
553B - Kyoya and Permutation
1729D - Friends and the Restaurant
1606C - Banknotes
580C - Kefa and Park
342A - Xenia and Divisors
1033A - King Escape
39D - Cubical Planet
1453A - Cancel the Trains
645A - Amity Assessment